package cn.ittaoli.movie.controller;

import cn.ittaoli.movie.model.Movie;
import cn.ittaoli.movie.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by lub_lenovo on 2017/11/6.
 */
@Controller
@RequestMapping("/detail")
public class IndexDetailController {
    @Autowired
    private MovieService movieService;

    @RequestMapping("/index/{id}")
    public String index(@PathVariable("id") Integer id,Model model){
        //System.out.println(id);
        Movie movie=movieService.getOne(id);
        model.addAttribute("movie",movie);
        return "/index/detail";
    }
}
